Skip to content

Commit 5bbc2e0

Browse files
committed
prerelease for vb
features - #1
0 parents  commit 5bbc2e0

File tree

912 files changed

+103005
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

912 files changed

+103005
-0
lines changed

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) Nicolas Gallagher.
4+
Copyright (c) Meta Platforms, Inc. and affiliates.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# React Native for Web
2+
3+
[![npm version][package-badge]][package-url] [![Build Status][ci-badge]][ci-url] [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactjs.org/docs/how-to-contribute.html#your-first-pull-request)
4+
5+
"React Native for Web" makes it possible to run [React Native][react-native-url] components and APIs on the web using React DOM.
6+
7+
## Documentation
8+
9+
The [documentation site](https://necolas.github.io/react-native-web/) ([source](https://github.com/necolas/react-native-web/blob/master/packages/react-native-web-docs)) covers installation, guides, and APIs.
10+
11+
## Example
12+
13+
The [examples app](https://p9t5cp.sse.codesandbox.io/) ([source](https://github.com/necolas/react-native-web/blob/master/packages/react-native-web-examples)) demonstrates many available features. Fork the [codesandbox](https://codesandbox.io/s/github/necolas/react-native-web/tree/master/packages/react-native-web-examples) to make changes and see the results.
14+
15+
You'll notice that there is no reference to `react-dom` in components. The `App` component that is shown below is defined using the APIs and Components of React Native, but it can also be rendered on the web using React Native for Web.
16+
17+
```js
18+
// Example component
19+
import React from 'react';
20+
import { AppRegistry, StyleSheet, Text, View } from 'react-native';
21+
22+
class App extends React.Component {
23+
render() {
24+
return (
25+
<View style={styles.box}>
26+
<Text style={styles.text}>Hello, world!</Text>
27+
</View>
28+
);
29+
}
30+
}
31+
32+
const styles = StyleSheet.create({
33+
box: { padding: 10 },
34+
text: { fontWeight: 'bold' }
35+
});
36+
37+
AppRegistry.registerComponent('App', () => App);
38+
AppRegistry.runApplication('App', { rootTag: document.getElementById('react-root') });
39+
```
40+
41+
## Contributing
42+
43+
Development happens in the open on GitHub and we are grateful for contributions including bugfixes, improvements, and ideas. Read below to learn how you can take part in improving React Native for Web.
44+
45+
### Code of conduct
46+
47+
This project expects all participants to adhere to Meta's OSS [Code of Conduct][code-of-conduct]. Please read the full text so that you can understand what actions will and will not be tolerated.
48+
49+
### Contributing guide
50+
51+
Read the [contributing guide][contributing-url] to learn about the development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native for Web.
52+
53+
### Good first issues
54+
55+
To help you get you familiar with the contribution process, there is a list of [good first issues][good-first-issue-url] that contain bugs which have a relatively limited scope. This is a great place to get started.
56+
57+
## License
58+
59+
React Native for Web is [MIT licensed](./LICENSE). By contributing to React Native for Web, you agree that your contributions will be licensed under its MIT license.
60+
61+
[package-badge]: https://img.shields.io/npm/v/react-native-web.svg?style=flat
62+
[package-url]: https://www.npmjs.com/package/react-native-web
63+
[ci-badge]: https://github.com/necolas/react-native-web/workflows/tests/badge.svg
64+
[ci-url]: https://github.com/necolas/react-native-web/actions
65+
[react-native-url]: https://reactnative.dev/
66+
[contributing-url]: https://github.com/necolas/react-native-web/blob/master/.github/CONTRIBUTING.md
67+
[good-first-issue-url]: https://github.com/necolas/react-native-web/labels/good%20first%20issue
68+
[code-of-conduct]: https://opensource.fb.com/code-of-conduct/
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
"use strict";
2+
3+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4+
5+
exports.__esModule = true;
6+
exports.default = void 0;
7+
8+
var _canUseDom = _interopRequireDefault(require("../../modules/canUseDom"));
9+
10+
/**
11+
* Copyright (c) Meta Platforms, Inc. and affiliates.
12+
*
13+
* This source code is licensed under the MIT license found in the
14+
* LICENSE file in the root directory of this source tree.
15+
*
16+
*
17+
*/
18+
function isScreenReaderEnabled() {
19+
return new Promise((resolve, reject) => {
20+
resolve(true);
21+
});
22+
}
23+
24+
var prefersReducedMotionMedia = _canUseDom.default && typeof window.matchMedia === 'function' ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;
25+
26+
function isReduceMotionEnabled() {
27+
return new Promise((resolve, reject) => {
28+
resolve(prefersReducedMotionMedia ? prefersReducedMotionMedia.matches : true);
29+
});
30+
}
31+
32+
function addChangeListener(fn) {
33+
if (prefersReducedMotionMedia != null) {
34+
prefersReducedMotionMedia.addEventListener != null ? prefersReducedMotionMedia.addEventListener('change', fn) : prefersReducedMotionMedia.addListener(fn);
35+
}
36+
}
37+
38+
function removeChangeListener(fn) {
39+
if (prefersReducedMotionMedia != null) {
40+
prefersReducedMotionMedia.removeEventListener != null ? prefersReducedMotionMedia.removeEventListener('change', fn) : prefersReducedMotionMedia.removeListener(fn);
41+
}
42+
}
43+
44+
var handlers = {};
45+
var AccessibilityInfo = {
46+
/**
47+
* Query whether a screen reader is currently enabled.
48+
*
49+
* Returns a promise which resolves to a boolean.
50+
* The result is `true` when a screen reader is enabled and `false` otherwise.
51+
*/
52+
isScreenReaderEnabled,
53+
54+
/**
55+
* Query whether the user prefers reduced motion.
56+
*
57+
* Returns a promise which resolves to a boolean.
58+
* The result is `true` when a screen reader is enabled and `false` otherwise.
59+
*/
60+
isReduceMotionEnabled,
61+
62+
/**
63+
* Deprecated
64+
*/
65+
fetch: isScreenReaderEnabled,
66+
67+
/**
68+
* Add an event handler. Supported events: reduceMotionChanged
69+
*/
70+
addEventListener: function addEventListener(eventName, handler) {
71+
if (eventName === 'reduceMotionChanged') {
72+
if (!prefersReducedMotionMedia) {
73+
return;
74+
}
75+
76+
var listener = event => {
77+
handler(event.matches);
78+
};
79+
80+
addChangeListener(listener);
81+
handlers[handler] = listener;
82+
}
83+
84+
return {
85+
remove: () => AccessibilityInfo.removeEventListener(eventName, handler)
86+
};
87+
},
88+
89+
/**
90+
* Set accessibility focus to a react component.
91+
*/
92+
setAccessibilityFocus: function setAccessibilityFocus(reactTag) {},
93+
94+
/**
95+
* Post a string to be announced by the screen reader.
96+
*/
97+
announceForAccessibility: function announceForAccessibility(announcement) {},
98+
99+
/**
100+
* Remove an event handler.
101+
*/
102+
removeEventListener: function removeEventListener(eventName, handler) {
103+
if (eventName === 'reduceMotionChanged') {
104+
var listener = handlers[handler];
105+
106+
if (!listener || !prefersReducedMotionMedia) {
107+
return;
108+
}
109+
110+
removeChangeListener(listener);
111+
}
112+
113+
return;
114+
}
115+
};
116+
var _default = AccessibilityInfo;
117+
exports.default = _default;
118+
module.exports = exports.default;
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
"use strict";
2+
3+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4+
5+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6+
7+
exports.__esModule = true;
8+
exports.default = void 0;
9+
10+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11+
12+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13+
14+
var React = _interopRequireWildcard(require("react"));
15+
16+
var _StyleSheet = _interopRequireDefault(require("../StyleSheet"));
17+
18+
var _View = _interopRequireDefault(require("../View"));
19+
20+
var _excluded = ["animating", "color", "hidesWhenStopped", "size", "style"];
21+
22+
var createSvgCircle = style => /*#__PURE__*/React.createElement("circle", {
23+
cx: "16",
24+
cy: "16",
25+
fill: "none",
26+
r: "14",
27+
strokeWidth: "4",
28+
style: style
29+
});
30+
31+
var ActivityIndicator = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
32+
var _props$animating = props.animating,
33+
animating = _props$animating === void 0 ? true : _props$animating,
34+
_props$color = props.color,
35+
color = _props$color === void 0 ? '#1976D2' : _props$color,
36+
_props$hidesWhenStopp = props.hidesWhenStopped,
37+
hidesWhenStopped = _props$hidesWhenStopp === void 0 ? true : _props$hidesWhenStopp,
38+
_props$size = props.size,
39+
size = _props$size === void 0 ? 'small' : _props$size,
40+
style = props.style,
41+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
42+
var svg = /*#__PURE__*/React.createElement("svg", {
43+
height: "100%",
44+
viewBox: "0 0 32 32",
45+
width: "100%"
46+
}, createSvgCircle({
47+
stroke: color,
48+
opacity: 0.2
49+
}), createSvgCircle({
50+
stroke: color,
51+
strokeDasharray: 80,
52+
strokeDashoffset: 60
53+
}));
54+
return /*#__PURE__*/React.createElement(_View.default, (0, _extends2.default)({}, other, {
55+
accessibilityRole: "progressbar",
56+
accessibilityValueMax: 1,
57+
accessibilityValueMin: 0,
58+
ref: forwardedRef,
59+
style: [styles.container, style]
60+
}), /*#__PURE__*/React.createElement(_View.default, {
61+
children: svg,
62+
style: [typeof size === 'number' ? {
63+
height: size,
64+
width: size
65+
} : indicatorSizes[size], styles.animation, !animating && styles.animationPause, !animating && hidesWhenStopped && styles.hidesWhenStopped]
66+
}));
67+
});
68+
ActivityIndicator.displayName = 'ActivityIndicator';
69+
70+
var styles = _StyleSheet.default.create({
71+
container: {
72+
alignItems: 'center',
73+
justifyContent: 'center'
74+
},
75+
hidesWhenStopped: {
76+
visibility: 'hidden'
77+
},
78+
animation: {
79+
animationDuration: '0.75s',
80+
animationKeyframes: [{
81+
'0%': {
82+
transform: [{
83+
rotate: '0deg'
84+
}]
85+
},
86+
'100%': {
87+
transform: [{
88+
rotate: '360deg'
89+
}]
90+
}
91+
}],
92+
animationTimingFunction: 'linear',
93+
animationIterationCount: 'infinite'
94+
},
95+
animationPause: {
96+
animationPlayState: 'paused'
97+
}
98+
});
99+
100+
var indicatorSizes = _StyleSheet.default.create({
101+
small: {
102+
width: 20,
103+
height: 20
104+
},
105+
large: {
106+
width: 36,
107+
height: 36
108+
}
109+
});
110+
111+
var _default = ActivityIndicator;
112+
exports.default = _default;
113+
module.exports = exports.default;

dist/cjs/exports/Alert/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
3+
exports.__esModule = true;
4+
exports.default = void 0;
5+
6+
/**
7+
* Copyright (c) Nicolas Gallagher.
8+
*
9+
* This source code is licensed under the MIT license found in the
10+
* LICENSE file in the root directory of this source tree.
11+
*
12+
*
13+
*/
14+
class Alert {
15+
static alert() {}
16+
17+
}
18+
19+
var _default = Alert;
20+
exports.default = _default;
21+
module.exports = exports.default;

dist/cjs/exports/Animated/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"use strict";
2+
3+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4+
5+
exports.__esModule = true;
6+
exports.default = void 0;
7+
8+
var _Animated = _interopRequireDefault(require("../../vendor/react-native/Animated/Animated"));
9+
10+
/**
11+
* Copyright (c) Nicolas Gallagher.
12+
*
13+
* This source code is licensed under the MIT license found in the
14+
* LICENSE file in the root directory of this source tree.
15+
*
16+
*
17+
*/
18+
var _default = _Animated.default;
19+
exports.default = _default;
20+
module.exports = exports.default;

0 commit comments

Comments
 (0)