# vnpt-rn-component

> RN Component

Latest version **0.2.4** (published 2024-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install vnpt-rn-component
pnpm add vnpt-rn-component
yarn add vnpt-rn-component
bun add vnpt-rn-component
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2024-03-20 |
| First published | 2023-06-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 16.0.0 |
| Dependencies | 7 |
| Unpacked size | 2.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ngnm1009 |
| Maintainers | ngnm, vnpt-media-software |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/vnpt-rn-component
- Repository: https://gitlab.com/ThaoVm/vnptbasecomponents
- Homepage: https://github.com/ngnm1009/vnpt-rn-component#readme
- Issues: https://github.com/ngnm1009/vnpt-rn-component/issues
- npm.io page: https://npm.io/package/vnpt-rn-component

## Dependencies (7)

- [mitt](https://npm.io/package/mitt.md) ^3.0.0
- [i18n-js](https://npm.io/package/i18n-js.md) 3.9.2
- [lodash.isequal](https://npm.io/package/lodash.isequal.md) ^4.5.0
- [react-native-svg](https://npm.io/package/react-native-svg.md) ^12.3.0
- [react-native-fast-image](https://npm.io/package/react-native-fast-image.md) ^8.6.3
- [react-native-date-picker](https://npm.io/package/react-native-date-picker.md) ^4.2.13
- [react-native-keyboard-aware-scroll-view](https://npm.io/package/react-native-keyboard-aware-scroll-view.md) ^0.9.5

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2024-03-20
- 0.2.3 — 2023-11-08
- 0.2.2 — 2023-11-02
- 0.2.1 — 2023-09-07
- 0.1.8 — 2023-06-16
- 0.1.7 — 2023-06-07
- 0.1.6 — 2023-06-06
- 0.1.5 — 2023-06-06
- 0.1.4 — 2023-06-06
- 0.1.3 — 2023-06-06
- 0.1.2 — 2023-06-06
- 0.1.1 — 2023-06-06
- 0.1.0 — 2023-06-05

## README

# vnpt-rn-component

VNPT RN Component

## Installation

```sh
npm install vnpt-rn-component
```

## iOS

* Edit `ios/Podfile`
  - Add `pod 'RNFastImage', :path => '../node_modules/react-native-fast-image'` to **Podfile**.
  - Run
       ```sh 
       cd ios && pod install
       ```

## Android

* Edit `android/settings.gradle`

```diff
rootProject.name = 'MyApp'

include ':app'

+ include ':react-native-fast-image'
+ project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android')
```

* Edit `android/app/build.gradle`

```diff
apply plugin: 'com.android.application'

android {
    ...
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
+   implementation project(':react-native-fast-image')
}
```

* Edit `android/app/src/main/java/.../MainApplication.java`

```diff
package com.myapp;

+ import com.dylanvann.fastimage.FastImageViewPackage;

....

            @Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          +   packages.add(new FastImageViewPackage());
          return packages;
        }

}
```

## Usage

```js
import React, { useState } from 'react';
import { StyleSheet } from 'react-native';

import {
  Box,
  Text,
  fontSizeLine,
  Color,
  heightLize,
  widthLize,
  Input,
  TouchRippleSingle,
  AlertProvider,
  Thumb,
  DatePicker,
  AppProvider,
} from 'vnpt-rn-component';
import TextTitle from './components/TextTitle';
import { translations } from './locales';

// ...

export default function App() {
  const [locales, setLocales] = useState('vi');
  return (
    <AppProvider
      locale={locales}
      translations={translations}
      onChangeLocale={(v) => {
        setLocales(v);
      }}
    >
      <AlertProvider>
        <Box flex={1} middle center>
          <Text size={fontSizeLine(14)} color={Color.black}>
            Hello vnpt
          </Text>
          <Box
            width={widthLize(40)}
            height={heightLize(40)}
            color={Color.red_04}
          />
          <Box
            row
            radius={50}
            border={1}
            margin={[widthLize(40), heightLize(20)]}
          >
            <Input
              flex={1}
              placeholder={'Some text'}
              padding={[widthLize(20), heightLize(20)]}
              size={fontSizeLine(14)}
              color={'red'}
            />
          </Box>
          <TouchRippleSingle
            onPress={() => {
              AlertProvider.show({
                title: 'Alert',
                content: 'Content',
                actions: [
                  { text: 'OK', onPress: () => console.log('On Press') },
                ],
              });
            }}
          >
            <Box
              padding={[widthLize(40), widthLize(10)]}
              color={'blue'}
              radius={50}
            >
              <Text size={fontSizeLine(14)} color={Color.white}>
                Button
              </Text>
            </Box>
          </TouchRippleSingle>
          <Thumb
            source={{
              uri: 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1200px-React-icon.svg.png',
            }}
            style={styles.image}
            resizeMode="contain"
          />
          <Thumb
            style={styles.image}
            resizeMode="contain"
            loadingColor={Color.white}
          />
          <DatePicker>
            <Text size={14}>Date picker</Text>
          </DatePicker>
          <TextTitle />
          <Text
            onPress={() => {
              setLocales((e) => (e === 'vi' ? 'en' : 'vi'));
            }}
            size={fontSizeLine(14)}
          >
            Change languages
          </Text>
        </Box>
      </AlertProvider>
    </AppProvider>
  );
}

const styles = StyleSheet.create({
  image: {
    width: 100,
    height: 100,
  },
});


```

---
_Source: https://npm.io/package/vnpt-rn-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
