Git Product home page Git Product logo

react-native-web-polyfill's Introduction

react-native-web-polyfill

A set of classes and react components to make work your react-native app in a browser. (with some limitations obviously)

WARNING!

This package is in pre-pre-pre-pre-pre-pre-pre-pre-pre-beta version! API will not change (as we are emulating the react-native ones ahah) but lots of components or properties could be missing. We encourage you to help us by reporting those or PR implementation of them! :D

What limitations?

Since it is all plain javascript, any native binary module won't be supported. By the way we are planning to provide an extra folder that will contains polyfills and workaround for the exposed api of some of these modules.

Check out the examples!

NOTE: Since the original UIExplorer contains a lot of examples that also uses native modules, we have copied only the components already ported, but the may miss support for some props.

How can i install this?

  • Move into your react-native project folder and install react-native-web-polyfill
npm install react-native-web-polyfill
  • Setup a webpack.config.js file for your project
  • Inside your webpack configuration, alias the react-native package to the react-native-web-polyfill package, and setup the external for the image loader.
{
  // other webpack config
  resolve: {
    alias: {
      "react-native": "react-native-web-polyfill"
    }
  }
  // setup the macro to resolve require("image!...")
  externals: [
    require("react-native-web-polyfill/src/macro/image")
  ],
}
  • Run webpack
  • Create an HTML document, with a div with an id="app" including the bundled webpack script and linking the css stylesheet node_modules/react-native-web-polyfill/style.css
  • Report any error to let us improve and help you! :D

Building the library

Move into the package folder and run in your terminal:

npm run build

Supported Classes & Components

  • StyleSheet

    • create
  • AppRegistry

    • getAppKeys
    • registerComponent
    • registerConfig
    • registerRunnable
    • runApplication
  • View

    • accessible
    • accessibilityLabel
    • accessibilityComponentType
    • accessibilityLiveRegion
    • accessibilityTraits
    • onAcccessibilityTap
    • onMagicTap
    • testID
    • onMoveShouldSetResponder
    • onResponderGrant
    • onResponderMove
    • onResponderReject
    • onResponderRelease
    • onResponderTerminate
    • onResponderTerminationRequest
    • onStartShouldSetResponder
    • onStartShouldSetResponderCapture
    • onLayout
    • pointerEvents
    • style
    • removeClippedSubviews useless
    • renderToHardwareTextureAndroid useless
    • shouldRasterizeIOS useless
    • collapsable
  • Text

    • numberOfLines
    • onLayout
    • onPress
    • suppressHighlighting
    • style
    • testID
    • allowFontScaling
  • Image

    • onLayout
    • resizeMode
    • source
    • style
    • testID
    • accessibilityLabel
    • accessible
    • capInsets
    • defaultSource
    • onError
    • onLoad
    • onLoadEnd
    • onLoadStart
    • onProgress
  • ScrollView

    • alwaysBounceHorizontal
    • alwaysBounceVertical
    • automaticallyAdjustContentInsets
    • bounces
    • bouncesZoom
    • canCancelContentTouches
    • centerContent
    • contentContainerStyle
    • contentInset
    • contentOffset
    • decelerationRate
    • directionalLockEnabled
    • horizontal
    • keyboardDismissMode
    • keyboardShouldPersistTaps
    • maximumZoomScale
    • minimumZoomScale
    • onScroll
    • onScrollAnimationEnd
    • pagingEnabled
    • removeClippedSubviews
    • scrollEnabled
    • scrollEventThrottle
    • scrollIndicatorInsets
    • scrollsToTop
    • showsHorizontalScrollIndicator
    • showsVerticalScrollIndicator
    • stickyHeaderIndices
    • style
    • zoomScale
  • TextInput

    • autoCapitalize
    • autoCorrect
    • autoFocus
    • clearButtonMode
    • clearTextOnFocus
    • defaultValue
    • editable
    • enablesReturnKeyAutomatically
    • keyboardType
    • maxLength
    • multiline
    • onBlur
    • onChange
    • onChangeText
    • onEndEditing
    • onFocus
    • onLayout
    • onSubmitEditing
    • placeholder
    • placeholderTextColor
    • returnKeyType
    • secureTextEntry
    • selectTextOnFocus
    • selectionState
    • style
    • testID
    • textAlign
    • textAlignVertical
    • underlineColorAndroid
    • value
  • TouchableHighlight

    • activeOpacity
    • onHideUnderlay
    • onShowUnderlay
    • style
    • underlayColor
  • TouchableOpacity

    • ...TouchableWithoutFeedback properties
    • activeOpacity
  • TouchableWithoutFeedback

    • accessible
    • delayLongPress
    • delayPressIn
    • delayPressOut
    • onLongPress
    • onPress
    • onPressIn
    • onPressOut

react-native-web-polyfill's People

Contributors

mattiamanzati avatar

Watchers

fxwan avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.