Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: null is not an object (evaluating 'NativeClipboard_1.default.getString')

I want to use @twotalltotems/react-native-otp-input in my expo project. I have go through with the documentation of @twotalltotems/react-native-otp-input But I'm getting this error. I have tried the solution from https://github.com/tttstudios/react-native-otp-input/issues/87

But none of that is worked for me! enter image description here

like image 447
Jim Khan Avatar asked Oct 12 '25 17:10

Jim Khan


1 Answers

For people using this package @twotalltotems/react-native-otp-input with expo, remember expo is not compatible with Clipboard package but itself offers another package expo-clipboard. So you've two ways -

  1. either use @twotalltotems/react-native-otp-input version 1.3.7 (it uses clipboard from react-native but throws a warning that Clipboard is deprecated.)
  2. Or you can hack around by copying this package code (from GitHub or node-modules) into your codebase. Create your own component and install expo install expo-clipboard and replace default clipboard import with import Clipboard from 'expo-clipboard'; in index.js file. Note - Do not make this change in node-modules as any package update will nullify your hack.