- yarn add react-native-config
- react-native link react-native-config
- Create .envfiles for each configuration. Ex:.env.dev,.env.prod, etc Ex:
API_ENDPOINT=https://api.myresource.com/dev
ENV=dev
| import * as React from 'react'; | |
| import { render } from 'react-native-testing-library'; | |
| import { Provider } from 'react-redux'; | |
| import { createStore } from 'redux'; | |
| import { MyContainerComponent, MyPresentationalComponent } from '...'; | |
| // Create a real redux store, with your reducers and middleware, and a useful initial | |
| // state tree... | |
| const store = createStore(...); | 
| import Control.Concurrent | |
| import Control.Monad | |
| import Data.Maybe | |
| import Data.Time | |
| import Network.Browser | |
| import Network.HTTP | |
| import Network.HTTP.Proxy | |
| import Network.URI | |
| import System.Locale | 
| http://miot-spec.org/miot-spec-v2/instances?status=all | |
| http://miot-spec.org/miot-spec-v2/instances?status=debug | |
| http://miot-spec.org/miot-spec-v2/instances?status=released | |
| and for example air purifier 3 cn (zhimi.airpurifier.ma4) | |
| https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-ma4:1 | |
| http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:light:0000A001:philips-bulb:1 | |
| http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:zhimi-sa1:1 | 
yarn add react-native-configreact-native link react-native-config.env files for each configuration. Ex: .env.dev, .env.prod, etc
Ex:API_ENDPOINT=https://api.myresource.com/dev
ENV=dev
| const widthPercentageToDP = widthPercent => { | |
| const screenWidth = Dimensions.get('window').width; | |
| const elemWidth = parseFloat(widthPercent); | |
| return PixelRatio.roundToNearestPixel(screenWidth * elemWidth / 100); | |
| }; | |
| const heightPercentageToDP = heightPercent => { | |
| const screenHeight = Dimensions.get('window').height; | |
| const elemHeight = parseFloat(heightPercent); | |
| return PixelRatio.roundToNearestPixel(screenHeight * elemHeight / 100); | |
| }; | 
| import * as React from 'react'; | |
| import { | |
| EmitterSubscription, | |
| Keyboard, | |
| KeyboardEvent, | |
| LayoutAnimation, | |
| Platform, | |
| Dimensions, | |
| ScreenRect, | |
| } from 'react-native'; | 
| + import com.facebook.react.modules.network.OkHttpClientProvider; | |
| + import okhttp3.OkHttpClient; | |
| + import okhttp3.brotli.BrotliInterceptor; | |
| ... | |
| public void onCreate() { | |
| super.onCreate(); | |
| + OkHttpClientProvider.setOkHttpClientFactory(() -> { | 
| - name: Restore yarn workspaces | |
| id: yarn-cache | |
| uses: actions/cache@master | |
| with: | |
| path: | | |
| node_modules | |
| */*/node_modules | |
| key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.yarn-cache.outputs.cache-hit != 'true' |