I try to use OTP input from this source:
but the following error appears:
undefined is not an object (evaluating ‘_expo.Constants.statusBarHeight’) (Device)
What could be the reason ?
That snack was clearly written for an older SDK version and has not been updated to work with newer SDKs. The error is because it’s expecting to find
Constants in the
expo package, but it was moved to
expo-constants a few SDK releases ago:
After you fix that you might find there’s other old code you need to fix before it works,
I added the line:
import Constants from ‘expo-constants’;
And installed the dependency, but the problem persisted.
Maybe there is another ready-made code for otp screen, working, or a library that supports expo? I just need a solution for otp screen.