Commit Graph

11 Commits

Author SHA1 Message Date
Ken Woo 3eee96ab86 Change React Native application layout check
Reviewed By: shergin

Differential Revision: D7076910

fbshipit-source-id: dc6df2dee886bbdf139d6e50192d621efad6d57e
2018-02-26 11:49:36 -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
Ramanpreet Nara efa4d3c222 Rename I18nManager Left/Right swap methods
Reviewed By: fkgozali

Differential Revision: D6140072

fbshipit-source-id: 282dc614c036de8f217a729f21a1bbe92b8afd7d
2017-10-24 20:45:59 -07:00
Ramanpreet Nara 98547d4bcf Implement gating support for direction-aware API changes
Reviewed By: achen1

Differential Revision: D6045083

fbshipit-source-id: 857a43029ad88d2324ec77145a1e30d92b5e8fae
2017-10-18 19:33:31 -07:00
Frank Manns 09680f71df Return instancetype for shared RCTI18nUtil instance
Summary:
In modern Objective-C you should use the `instancetype` keyword for methods which return an instance of the class they are called on. See Apple's [Adopting Modern Objective-C](https://developer.apple.com/library/content/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObjective-C/AdoptingModernObjective-C.html) guide.

Because `sharedInstance` was returning an object of type `id`, the returned value needed to be cast before it could be used in Swift.

I also changed the implementation of `sharedInstance` to use Grand Central Dispatch, which is the generally accepted best way of creating a singleton in Objective-C.

I verified my changes with the "RTLExample" app in RNTester.

| LTR | RTL |
|---|---|
|<img width="300" src="https://user-images.githubusercontent.com/1413388/31155210-6454b4d6-a87a-11e7-9dd7-9a52f3924737.png">|<img width="300" src="https://user-images.githubusercontent.com/1413388/31155233-8702aff6-a87a-11e7-8028-51cf2b3eb0c4.png">|
Closes https://github.com/facebook/react-native/pull/16196

Differential Revision: D5971898

Pulled By: shergin

fbshipit-source-id: dfa375c89248adfc9fd885cacc6a6d4cbfea6e90
2017-10-03 20:11:16 -07:00
Kevin Gozali 96de161304 enable RTL layout by default for all apps
Summary:
We're now enabling RTL layout by default assuming the app has the proper localized assets. Previously, this was disabled by default to minimize surprise. Apps that don't want this RTL support can still manually disable them by using `RCTI18nUtil.allowRTL(false)` (iOS) or `I18nUtil.allowRTL(false)` (android) in the apps start-up logic, as outlined in the blog post: http://facebook.github.io/react-native/blog/2016/08/19/right-to-left-support-for-react-native-apps.html

iOS Util function: f0fb228ec7/React/Modules/RCTI18nUtil.m (L53)
Android Util function: 380830e4aa/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java (L63)

Differential Revision: D3825054

fbshipit-source-id: 88b355fef9e3847939a414f80d2285979e27af08
2016-09-06 17:58:47 -07:00
Mengjue Wang f0fb228ec7 Provide forceRTL for LTR language to test
Summary:
1. Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
2. Rename `allowRTL` and `setAllowRTL` functions

Reviewed By: fkgozali

Differential Revision: D3663693

fbshipit-source-id: 3db13a44c069ae73d1728c211306422db5dd8122
2016-08-04 12:28:30 -07:00
Mengjue Wang 0c818586ca Change forceRTL to allowRTL
Summary: Rename the forceRTL to allowRTL so that make it much clear to read. And change a typo.

Reviewed By: fkgozali

Differential Revision: D3489235

fbshipit-source-id: b9803dfbcda2f764b7e752c9810cfc7a0b9fe39b
2016-06-27 12:58:21 -07:00
Mengjue Wang 0e07c36794 Provide function that could read app current using language
Summary: Provide function that could read the language currently used in the app, so the isRTL is using the app current using language to set isRTL.

Reviewed By: fkgozali

Differential Revision: D3480654

fbshipit-source-id: dea3ef4769296f594f7f32da2961b4fec1b99a7a
2016-06-24 19:43:44 -07:00
Mengjue Wang fa6022dc1a Connect the OS language with isRTL
Summary: Create isDeviceLanguageRTL function to connect the OS language with isRTL. Now even if a new app could support RTL language, without setting forceRTL at JS side it won't directly change into RTL layout.

Reviewed By: fkgozali

Differential Revision: D3473109

fbshipit-source-id: ac1410c910e980d44750bb88cad7615febb9e076
2016-06-23 18:58:30 -07:00
Mengjue Wang 88c6e7a22b Create a module for React Native to get IsRTL info and set ForceRTL 1/2
Summary: Create a module for React Native to get IsRTL information and set ForceRTL function.

Reviewed By: fkgozali

Differential Revision: D3446871

fbshipit-source-id: 736edf138a89d222818071370ac49dc54bda63b7
2016-06-21 11:58:39 -07:00