# Migrate from react-native-otp-entry

> Switch from react-native-otp-entry to Patine UI: InputOTP with the same cells and blinking caret, SMS code autofill, paste, a PIN mode, and iOS, Material and web designs from your theme.

# Migrate from `react-native-otp-entry`

```diff
- import { OtpInput } from 'react-native-otp-entry';
+ import { InputOTP } from 'patine-ui';

- <OtpInput
-   numberOfDigits={6}
-   focusColor="#007AFF"
-   onTextChange={setCode}
-   onFilled={verify}
-   theme={{ pinCodeContainerStyle: styles.cell, focusedPinCodeContainerStyle: styles.focused }}
- />
+ <InputOTP
+   autoFocus
+   onValueChange={setCode}
+   onComplete={verify}
+   theme={{ colors: { primary: '#007AFF' } }}
+   styles={{ cell: styles.cell, focusedCell: styles.focused }}
+ />
```

| otp-entry | Patine UI |
| --- | --- |
| `numberOfDigits` | `length` (default `6`) |
| `onTextChange` | `onValueChange` |
| `onFilled` | `onComplete` |
| `autoFocus` (default `true`) | `autoFocus` (default `false`) |
| `focusColor` | `theme={{ colors: { primary } }}` |
| `type="numeric"` / `"alphanumeric"` | `inputMode="numeric"` / `"text"` |
| `secureTextEntry` / `disabled` | `secureTextEntry` / `disabled` |
| `blurOnFilled` | `onComplete={(code) => { Keyboard.dismiss(); verify(code); }}` |
| `hideStick` | `styles={{ caret: { opacity: 0 } }}` |
| `theme.containerStyle` | `styles.container` |
| `theme.pinCodeContainerStyle` | `styles.cell` |
| `theme.focusedPinCodeContainerStyle` | `styles.focusedCell` |
| `theme.filledPinCodeContainerStyle` | `styles.filledCell` |
| `theme.pinCodeTextStyle` | `styles.cellText` |
| `theme.focusStickStyle` | `styles.caret` |
| `ref.clear()` / `ref.setValue(code)` | a controlled `value` |
| `textInputProps.accessibilityLabel` | `accessibilityLabel` (default *Verification code*) |

Without a `styles` override, [`InputOTP`](../../components/input-otp)'s cells look like the [design's](../../guides/designs.mdx) text fields: iOS on iPhone, Material on Android and outlined boxes with a focus ring on the web.

See [all migration guides](./index.mdx) for other libraries, and [Comparison](../comparison.mdx) for when another library is the better choice.
