Commit Graph

1376 Commits

Author SHA1 Message Date
Evan Bacon
fa09df8b59 [fix] ScrollView support for hiding scroll indicators
Implements 'showsHorizontalScrollIndicator' and 'showVerticalScrollIndicator' by polyfilling the 'scrollbar-width' property from the draft CSS spec for scrollbars. Scrollbars can only be shown for both or neither axis.

Close #1307

Co-authored-by: Nicolas Gallagher <nicolasgallagher@gmail.com>
2019-05-21 11:02:38 -07:00
Nicolas Gallagher
be5106f5d3 [fix] textDecoration{Color,Line,Style} styles
Attempting to fallback to CSS2 text-decoration is not reliable for inline
styles. This patch assumes CSS3 text-decoration support when server-rendering,
and uses CSS.supports to check for runtime support. When CSS3 support is
available the long-form properties are preserved.

Fix #1312
2019-05-15 17:33:53 -07:00
Charlie Croom
37ca236d09 [fix] Image displays defaultSource until source load completes
This fixes an issue that would cause the defaultSource to be removed as soon as
the source beings to load. The original intent was to support progressive
JPEGs. However, in cases where a defaultSource has been provided, we should
respect the intent to display it until the primary source is ready to
immediately replace the defaultSource.

Close #1345
2019-05-15 16:17:00 -07:00
Charlie Croom
950bfd039c [add] Image.queryCache API
Image.queryCache is a React Native method that allows the user to see
if a given uri is in the cache. It specifies three return options:
disk, memory or both. Choosing both seemed most appropriate since
we don't really know and can't confirm.

The way Image is implemented, if RNW thinks the image might already
be loaded, it displays it immediately. Otherwise there can be a flash
of a frame. In some scenarios, if the user chooses to preload and then
make an Image element, it would still flash. By adding it to the cache,
we can prevent that.

Close #1344
2019-05-15 15:41:05 -07:00
Nicolas Gallagher
39d2e18ccf [fix] Text accessibilityRole propTypes warning
Close #1320
2019-05-15 11:23:24 -07:00
Nicolas Gallagher
e9f68e380b [fix] Avoid using Object.values
Not everyone is polyfilling older environments

Fix #1334
2019-05-15 11:22:02 -07:00
Doug Miller
2ce434e8f8 [fix] Babel plugin rewrite for main index require
Recently the default export was removed from react-native-web. In some
scenarios it is possible to still get to this import path which does not work
anymore. Removing the `.default` fixes commonjs imports from index.

Close #1341
2019-05-15 11:05:35 -07:00
Janic Duplessis
3eeda686b1 [fix] Prevent maxFontSizeMultiplier prop forwarding to DOM
Close #1313
2019-05-15 10:59:36 -07:00
MoOx
70e3ea8b57 Add documentation for Node.js module aliasing
Close #1315
2019-05-15 10:57:51 -07:00
ashbhir
cc99391f9d [fix] Text default border style
Close #1335
2019-05-15 10:45:05 -07:00
Yukiya Nakagawa
27713bd8cc Fix docs typo
Close #1297
2019-05-15 10:44:31 -07:00
Nicolas Gallagher
801937748b 0.11.2 2019-03-22 10:02:44 -07:00
Nicolas Gallagher
9cbe387d9f [fix] CSS insertion in Edge browser
Edge browser throws `HierarchyRequestError` while inserting CSS rules into CSS
Media Queries. Therefore, a different mechanism is required to control CSS
order. This patch tracks the starting index of each group of CSS rules in the
DOM style sheet.

Fix #1300
Close #1302
2019-03-22 09:58:18 -07:00
Nicolas Gallagher
c1459d7b21 Remove '!important' check from setValueForStyles
'!important' styles are no longer used internally and are not supported in the
public API.
2019-03-19 10:32:59 -07:00
Mathieu Acthernoene
36dacb2052 [change] Update flow-bin to 0.95.1
Fix related type errors

Close #1269

Co-authored-by: Nicolas Gallagher <nicolasgallagher@gmail.com>
2019-03-18 13:00:05 -07:00
Nicolas Gallagher
b732cec83e Fix copyright headers 2019-03-18 11:13:17 -07:00
Nicolas Gallagher
ad78fc7a38 0.11.1 2019-03-15 14:08:24 -07:00
Nicolas Gallagher
33e54c755b [fix] StyleSheet SSR of classic CSS
Hack something together to get classic CSS going through the same pathway as
the rest of the styles. This gets classic CSS showing up in the SSR CSS output.

Fix #1286
2019-03-15 10:20:56 -07:00
Paul Armstrong
74a36a2a4e [fix] Jest preset module export
Export the preset as a module so that paths can be resolved relative to a Jest
config file.

Close #1290
2019-03-15 10:07:56 -07:00
Nicolas Gallagher
8d1f5afead Fix website Image examples
Remove use of 'resizeMode' static, which is no longer supported.
2019-03-14 14:20:25 -07:00
Nicolas Gallagher
763e2d4001 0.11.0 2019-03-12 17:45:10 -07:00
Nicolas Gallagher
f507410ab4 [fix] Schema prop types
Ref 34427897f3
2019-03-12 17:43:22 -07:00
Nicolas Gallagher
97372d7e4c Update benchmark results for 0.11.0 2019-03-12 17:30:10 -07:00
Nicolas Gallagher
9872c97169 Remove whitespace from CSS rules
Minimizes bytes from CSS code that might be inlined in the head of the document
during SSR.
2019-03-12 13:53:48 -07:00
Nicolas Gallagher
d50f6304dc [change] Add className prop deprecation warning
View and Text will not support the 'className' prop in a future release.

Fix #1146
2019-03-12 13:00:57 -07:00
Nicolas Gallagher
330895534d [change] CSS class prefix 'rn' -> 'r' 2019-03-12 13:00:57 -07:00
Nicolas Gallagher
0e302a50d2 [change] Refactor style resolver
Minor refactor of the style resolver to convert it to a factory function.
2019-03-12 13:00:57 -07:00
Nicolas Gallagher
f048d848a1 [change] Replace outline with outline{Color,Style,Width} styles
Rather than mix shortform and longform properties, the 'outline' property is
removed in favour of the longform properties. Support for `outlineOffset` is
also included.

Fix #1255
Close #1256
2019-03-12 13:00:57 -07:00
Nicolas Gallagher
c68b532696 [change] StyleSheet validation
Stop relying on React internals and propTypes validation.
2019-03-12 13:00:57 -07:00
Nicolas Gallagher
d4417e93a3 [change] Use classic CSS in View, Text, etc., implementations
The CSS base styles for certain primitives are implemented using classic CSS to
reduce browser layout times and better support 'null' values in
StyleSheet-defined styles. Combined with the previous patch this reduces the
benchmark layout times by about 30%.

Ref #1136
Fix #1044
Fix #1223
Fix #13
2019-03-12 13:00:57 -07:00
Nicolas Gallagher
9f860b8dfc [change] StyleSheet: compile styles directly to CSS
Introduces a centralized compiler for "atomic" and "classic" CSS output. The
"classic" compiler is for internal use only and offers no CSS safety
guarantees. The "atomic compiler is used to implement the public-facing
StyleSheet API.

The atomic compiler now maps the React style declarations, rather than CSS
style declarations, to CSS rules. This avoids having to convert React styles to
CSS styles before being able to lookup classNames. And it reduces the number of
CSS rules needed by each DOM element.

Before:

    { paddingHorizontal: 0; }
        ↓
    .paddingLeft-0 { padding-left: 0; }
    .paddingRight-0 { padding-right: 0; }

After:

    { paddingHorizontal: 0; }
        ↓
    .paddingHorizontal-0 { padding-left: 0; padding-right: 0 }

Overview of previous StyleSheet resolver:

1. Localise styles
2. Transform to CSS styles
3. Expand short-form properties
4a. Lookup Atomic CSS for each declaration
4b. Compile Atomic CSS for each static declaration
  i. Vendor prefix
  ii. Insert CSS rules
4c. Create inline style for each dynamic-only declaration
  i. Vendor prefix

Overview of new StyleSheet design:

1. Localise styles
2a. Lookup Atomic CSS for each declaration
2b. Compile Atomic CSS for each static declarations
  i. Transform to CSS styles
  ii. Expand short-form properties
  iii. Vendor prefix
  iiii. Insert CSS rules
2c. Create inline style for each dynamic-only declaration
  i. Transform to CSS styles
  ii. Expand short-form properties
  iii. Vendor prefix

Ref #1136
2019-03-12 13:00:57 -07:00
Nicolas Gallagher
29be779f77 [change] CSS insertion by OrderedCSSStyleSheet
`OrderedCSSStyleSheet` can be used to control the order in which CSS rules are
inserted. This feature is necessary to support the combined use of Classic CSS
and Atomic CSS. It also makes it possible to control the order of Atomic CSS
rules, which is necessary to correctly resolve style conflicts (e.g., between
'margin' and 'marginHorizontal') without expanding short-form properties to
long-form properties.

Ref #1136
2019-03-12 13:00:57 -07:00
Evan Bacon
2a418bed0c [change] Organize unimplemented modules in directories
Creates a {path}/index.js for each module that has no web
implementation. This enables the babel preset to rewrite all paths and
prevent apps from bundling unused modules.

Fix #1281
Close #1282
2019-03-11 21:13:16 -07:00
Nicolas Gallagher
5e9449e893 Update benchmark libraries 2019-03-11 20:17:29 -07:00
Alec Winograd
67979b7282 [add] TextInput support for "onContentSizeChange"
Fix #793
Close #1226
2019-03-11 14:14:13 -07:00
Nicolas Gallagher
3d3ea9aeed [change] Remove ART export
Anticipate the removal of ART from React Native core:
https://github.com/facebook/react-native/issues/23313

Simplifies dependencies and builds for web apps.

Close #1251
2019-03-11 13:33:49 -07:00
Nicolas Gallagher
69bd0f631d [change] Remove default ES Module export
Remove the default export that was provided for compatibility with legacy
imports of React Native CommonJS modules. These patterns are no longer
supported:

```
import ReactNative from 'react-native';
const ReactNative = require('react-native');
```

Fix #1258
Close #1277
2019-03-11 13:12:24 -07:00
Evan Bacon
9ce2b5bf0c [fix] NativeEventEmitter implementation
Close #1275
2019-03-08 13:06:19 -08:00
Hiroki Sato
cf7b020c5d [fix] set textShadow if only blur and color provided
Mirrors a recent fix to React Native.

Close #1182
2019-03-08 12:42:36 -08:00
Nicolas Gallagher
49edcb291e [change] remove 'resizeMode' static from 'Image'
Use strings instead of the 'Image.resizeMode' static. Corresponding change in React Native:

https://github.com/facebook/react-native/commit/870775e
2019-03-08 12:40:59 -08:00
Nicolas Gallagher
6a84d74185 0.10.1 2019-03-07 11:32:33 -08:00
Nicolas Gallagher
282cb34054 Fix npm publish errors 2019-03-07 11:31:50 -08:00
Wyatt Greenway
421cb095f7 [fix] PickerItem cyclic dependency
Close #1270
2019-03-07 11:06:48 -08:00
Nicolas Gallagher
0c08ba3a7d [fix] Text support for accessibilityRole="none"
Fix #1262
2019-03-07 11:02:57 -08:00
Nicolas Gallagher
e4c3a21c42 [fix] TextInput autoComplete="off"
Browsers treat autoComplete "off" as "on". The fix is to provide the browser
with an unrecognized value so that it doesn't attempt to auto-fill the input.

Fix #1249
2019-03-07 10:58:27 -08:00
Nicolas Gallagher
34427897f3 [add] Support for Schema prop types
View and Text forward Schema prop types to host DOM node.
https://schema.org/docs/gs.html

Fix #1247
2019-03-07 10:50:34 -08:00
Dan Alloway
63868b492d Fix project scripts in Windows environments
Close #1252
2019-03-01 14:49:55 -08:00
Nicolas Gallagher
8ce5750d34 0.10.0 2019-01-30 14:13:58 -08:00
Nicolas Gallagher
eb77062608 Remove unnecessary snapshot tests
Remove snapshots that were unnecessarily recording generated CSS output.
2019-01-22 18:48:29 -08:00
Nicolas Gallagher
b6fc6f228e Add new Text render benchmark 2019-01-22 18:48:29 -08:00