Commit Graph

19 Commits

Author SHA1 Message Date
Eli White 4895c645ea Rename Style to DangerouslyImpreciseStyle
Reviewed By: yungsters

Differential Revision: D7190268

fbshipit-source-id: d652a95be7550d65cfbfc59f41d7bda92915bacf
2018-03-08 01:08:42 -08:00
Eli White 852084ad45 Remove usage of Styles type
Summary: This type was often used when (View|Text|Image)StyleProp should have been used instead. Since there were no valid usages of it in our codebase, we are not making it public anymore.

Reviewed By: yungsters

Differential Revision: D7188658

fbshipit-source-id: 7112cc4a7da7b007b5c758a0890d2e0b8fe1797a
2018-03-08 01:08:41 -08:00
Eli White d89517d60a Remove usage of Internal StyleSheet type
Summary: This type shouldn't be necessary from outside code. All callsites were able to be fixed by using the other types like TextStyleProp

Reviewed By: yungsters

Differential Revision: D7187551

fbshipit-source-id: 34fb7fb5f5e72e6cfcb9748157cb5eb6ad3e1f46
2018-03-08 01:08:41 -08:00
Eli White cf89a2cbfd Move __StyleProp to StyleSheet
Reviewed By: yungsters

Differential Revision: D7185815

fbshipit-source-id: 897ae37af3f03aa1408f020bcc7e61004d4dbc0d
2018-03-07 16:32:55 -08:00
Eli White a3c07c95ef StyleObj -> DangerouslyImpreciseStyleProp
Summary:
Migrating everything to import from StyleSheet instead of StyleSheetTypes.

Search and replaced
```
import type {StyleObj} from 'StyleSheetTypes';
```
to
```
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
```

and then replacing `StyleObj` with `DangerouslyImpreciseStyleProp` and fixing up the remaining flow errors by hand.

Reviewed By: yungsters

Differential Revision: D7184077

fbshipit-source-id: b8dabb9d48038b5a997ab715687300bad57aa9d4
2018-03-07 13:24:20 -08:00
Eli White ee26d9bcb0 Make StyleSheet.create type private
Summary:
This type is being used in many places where a much simpler type is often better. In a real pinch this type can still be accessed as so:

```
function returnsStyleSheet(
): $Call<typeof StyleSheet.create, *> {
  return StyleSheet.create({
    root: {
      background: 'white',
    }
  })
}

returnsStyleSheet().foo // foo doesn't exist
returnsStyleSheet().root // okay
```

Reviewed By: yungsters

Differential Revision: D7178524

fbshipit-source-id: 3c0ed03486ca00f1e287261e402fd47807f1fc3d
2018-03-07 12:16:53 -08:00
Eli White b58e377961 Remove Unused Exports from StyleSheetTypes
Summary: These types were barely used and unnecessary.

Reviewed By: yungsters

Differential Revision: D7177287

fbshipit-source-id: 63cb6d3aae4889a92b2c23f0df864b5657e6e1ee
2018-03-06 23:30:48 -08:00
Eli White 321ba067a8 Type TextStyleProp
Reviewed By: yungsters

Differential Revision: D7176472

fbshipit-source-id: 35f499bdac6c089d5f45884f6f11ea539c8b7085
2018-03-06 23:30:47 -08:00
Eli White c129457d3a Typing ViewProp, ImageProp
Summary:
Tightening these types.

We can't type TextProp the same way yet because of something fishy in Flow:

https://flow.org/try/#0KYDwDg9gTgLgBDAnmYcAqoYGUkBtUC8cA3gD4BQccAZhAHYwBiAhgLYCWuiAXHAM4wo7OgHMANJRr1s7AF7BedAK6sARsCgTSAXwDc5cqEiwEyVIwAiWRtJyJ8cImUm0GLDl14ChorXoNG0PBIKOiYdvgAClAQYI5wACQASsDMACYA8nRcADwJWAAWzCg5GCDYeMAAfFW6cAD09XAprBAAbqjJqZnZiHDMdGkIBagaMVBwIhDAfP0A7syIBgDG9AJwllgRChtWNgzb8cQu0u6cPHAA5LQQlxL+5Kt062UV9sAAasxQvK-b0bF4pttrogA

Reviewed By: olegbl

Differential Revision: D7165134

fbshipit-source-id: 2fd3de2af8bdc53231d59de71def1e6a7221aff7
2018-03-06 18:47:12 -08:00
Eli White b6c7e551a9 Using ReadOnly and Exact types for StyleSheet
Summary: There are a few more things that need to be tightened up but they cause *tons* of errors in FBSource and require more investigation before we can change them.

Reviewed By: sahrens

Differential Revision: D7160522

fbshipit-source-id: 17167efd80fd6c3bac5a055d2ab58b3b251c1b8b
2018-03-05 18:57:30 -08:00
Eli White b98bf1e097 Remove polymorphic types from StyleSheetTypes
Summary:
These types were polymorphic so that stricter types could be passed in for dimension or color. For example, color could be a union of allowed colors. However, since `rgb(0,0,0)` is a valid color, these would have to be allowed opaque types and every creator or caller of these colors would have to use a function.

This would require a massive change to every RN product in the world for negligable gain because StyleSheet values are validated at dev at runtime and cause redboxes for invalid uses.

Since we don't plan to adopt these widely, lets clean up the complexity of these types.

Reviewed By: sahrens

Differential Revision: D7158920

fbshipit-source-id: c58ae402c8248b0863c217c27153191a49c6b980
2018-03-05 18:57:30 -08:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Agastya Darma b1cdb7d553 Implementing space-evenly
Summary:
So in v0.52.0 space-evenly is introduced but not yet implemented (1050e0b by woehrl01). This pull request implements the space-evenly.

Manual Testing.
![notes marker](https://i.imgur.com/IXmezVY.png)

[IOS] [FEATURE] [Yoga] Adding space-evenly on justify-content in iOS
[ANDROID] [FEATURE] [Yoga] - Adding space-evenly on justify-content in Android
Closes https://github.com/facebook/react-native/pull/17805

Differential Revision: D6858294

Pulled By: shergin

fbshipit-source-id: 7a705ca05f58603ef4588e1bfd16c16a78f8a390
2018-01-31 10:17:22 -08:00
Tim Yung 3fc33bb54f RN: Add Missing Start/End Style Types
Reviewed By: shergin

Differential Revision: D6813953

fbshipit-source-id: eed5dcaa2b6f4101f03d7fe1fca9d20c0f6a6429
2018-01-25 22:01:05 -08:00
Naman Goel da047966e4 Improve types for React Native styles.
Reviewed By: TheSavior

Differential Revision: D6226807

fbshipit-source-id: b64a77383e6e685f4017c47fc9a5095ed63b062c
2017-11-14 13:18:33 -08:00
Jeff Morrison 7795918eb4 Unrevert D3518381
Reviewed By: gabelevi

Differential Revision: D3522895

fbshipit-source-id: 52f28c7f3142566a07d8bc845be882aeda098809
2016-07-06 12:58:41 -07:00
Ian Childs 0fde81c816 Reverted commit D3518381
Reviewed By: gabelevi

Differential Revision: D3518381

fbshipit-source-id: 645c25191d5e7cff7689bd4dc583c478eba46496
2016-07-06 09:43:37 -07:00
Jeff Morrison a8e6a236cc fbobjc -> Flow v0.28
Reviewed By: gabelevi

Differential Revision: D3518381

fbshipit-source-id: 2dd5f89177aaefbd098ba1fd3c193da111ff14c7
2016-07-06 08:58:42 -07:00
Gabe Levi 874f39bf7f [Flow] Clean up react-native for Flow v0.15.0 2015-09-04 16:51:18 -08:00