You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got an AnimatedTextInput that I update with animatedProps so that the text changes based on the position on screen. It can also be updated by userInput. I've used the standard createAnimatedPropAdapter as noted below:
When testing on devices or emulator these updates render correctly.
However when using jest and react native testing library I simulate a user input and the animatedProps do not appear to update. In addition I get an error message that appears to suggest that the props are not updated until after the test environment is torn down.
ReferenceError: You are trying to import a file after the Jest environment has been torn down.
at Object.get Platform [as Platform] (node_modules/react-native/index.js:351:12)
at _f (node_modules/react-native-reanimated/lib/reanimated2/UpdateProps.js:27:22)
at updatePropsJestWrapper (node_modules/react-native-reanimated/lib/reanimated2/UpdateProps.js:60:3)
at _f (node_modules/react-native-reanimated/lib/reanimated2/Hooks.js:468:47)
at Mapper._f [as mapper] (node_modules/react-native-reanimated/lib/reanimated2/Hooks.js:536:11)
I have followed the setup instructions per the documentation, and I'm currently using the latest stable version 2.2.0.
If it is possible - any suggestions on how to trigger the update in test would be much appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've got an AnimatedTextInput that I update with animatedProps so that the text changes based on the position on screen. It can also be updated by userInput. I've used the standard createAnimatedPropAdapter as noted below:
const adapter = createAnimatedPropAdapter((props) => {
if (Object.keys(props).includes("value")) {
props.text = props.value;
delete props.value
}
}, ["value"]);
When testing on devices or emulator these updates render correctly.
However when using jest and react native testing library I simulate a user input and the animatedProps do not appear to update. In addition I get an error message that appears to suggest that the props are not updated until after the test environment is torn down.
ReferenceError: You are trying to
import
a file after the Jest environment has been torn down.at Object.get Platform [as Platform] (node_modules/react-native/index.js:351:12)
at _f (node_modules/react-native-reanimated/lib/reanimated2/UpdateProps.js:27:22)
at updatePropsJestWrapper (node_modules/react-native-reanimated/lib/reanimated2/UpdateProps.js:60:3)
at _f (node_modules/react-native-reanimated/lib/reanimated2/Hooks.js:468:47)
at Mapper._f [as mapper] (node_modules/react-native-reanimated/lib/reanimated2/Hooks.js:536:11)
I have followed the setup instructions per the documentation, and I'm currently using the latest stable version 2.2.0.
If it is possible - any suggestions on how to trigger the update in test would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions