TaylorBriggs/react-native-typewriter

Passing Style props to <TypeWriter> component works only for few properties.

Closed this issue · 5 comments

Code i have used

TypeWriter style={StyleSheet.flatten(styles.text)} typing={1}
{this.state.keithVoice}
/TypeWriter

text: {
fontSize: 20,
fontWeight: "bold",
color: "red"
}

The above code only changes color of text to red,however other props do not seem to work like fontWeight and fontSize
Can somebody give a working example of how to pass styles to this component?

Hi @hvardhan617. Sorry you're having an issue. Can you let me know which versions of React and React Native you're using? Are you seeing this problem on Android or iOS or both? What happens when you pass the style as a plain object instead of using StyleSheet.flatten?

Hi @TaylorBriggs .
Am using RN version 0.49.5 and "react": "16.0.0",
Actually am using this in my VR app written in React 360 which uses similar components as React native.
I tried using plain style object which did not work for all properties except color,then i went through the issues and changed it to Stylesheet.flatten

Code that isnt working-

TypeWriter style={{fontSize:30,fontWeight:"bold",color:'yellow'}} typing={1}
{this.state.keithVoice}
/TypeWriter

The above code isnt working for properties fontSize and fontWeight

Hi @hvardhan617. I think your best solution is to fork this repository and make it depend on React 360 instead of React Native. The Text component in React 360 looks similar to that from React Native, but there's likely differences under the hood that are affecting how the style prop is handled. All of the style is passed directly to the Text component here, so it should work for the supported styles in React 360.

@hvardhan617 maybe v0.5.4 fixes your issue?

Closing due to inactivity and that this library is for react native, not react 360.