Expo freezes if using ReactNative's StyleSheet

Viewed 125

I have encountered a bug with react-native's Stylesheet component. It causes my iphone simulation to stay stuck on expo's logo after loading the js bundle. No errors to be found.

import { Text, View, StyleSheet } from "react-native"

var styles = StyleSheet.create({
  innerText: {
    color: 'red',
  }
})

export var TestComponent = function() {
  return (<View><Text style={styles.innerText}>NOW Lets get this working</Text></View>)
}

If I just put the style inline, it works and renders correctly. No freezing after bundle loading.

  return (<View><Text style={{color:'red'}}>NOW Lets get this working</Text></View>

One thing to note is that this TestComponent is coming from a node_module. Stylesheet's work as expected in the app's codebase, but fail when coming from this node_module.

1 Answers

The module that exports the TestComponent was using react-native 0.68.0, but the app that uses the module was using react-native 0.64.3. When I downgraded the module to the same react-native version, it worked.

It also worked when updating the app's version instead of downgrading the other, but this time expo gives a warning: Warning: Invalid version react-native@0.68.1 for expo sdkVersion 44.0.0. Use react-native@0.64.3

Related