StyleSheet.create not working for input in web project?

Im making a ‘universal’ native and web app. For a slider component im using @react-native-community/slider but it doens’t yet support React Native Web, so I’m using the .native file extension to target different platforms.

For the web I need custom styles on an <input type="range" /> element. If I set inline styles it’s fine, however when I use StyleSheet.create I get an error:

const styles = StyleSheet.create({
  container: {
    flex: 1,
    background: "blue",
  inputS: {
    opacity: .5,

const Slider: React.FC<Props> = () => {
  return (
    <View style={styles.container}>
        // These commented out styles are fine
        // style={{
        //  opacity: .5,
        // }}

The error is:

A fatal error was encountered while rendering the root component.

Review your application logs for more information, and reload the app when the issue is resolved. In production, your app would have crashed.

However I dont see any any errors in my terminal.

I assume this is because StyleSheet.create is a React Native function and an <input /> is not a React Native element? What’s the best practice in this situation?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.