glamorous-native icon indicating copy to clipboard operation
glamorous-native copied to clipboard

Dynamically determine which react-native elements are supported

Open atticoos opened this issue 7 years ago • 0 comments

Currently we manually test newer React Native components to ensure they're supported by the dependent's version of React Native.

Instead, the library could be more flexible by dynamically asserting if the component exists.

Something like

import {
  View,
  FlatList,
  ... // etc
} from 'react-native'

const components = {View, FlatList, ...}

const supportedComponents = Object.keys(components).reduce((acc, componentName) => {
  if (components[componentName]) {
    components[componentName] = component
  }
  return components
}, {})

atticoos avatar Jan 13 '18 05:01 atticoos