Monday, October 18, 2021

Hide shadow or margin under react native header

 In old <5 react native you could just hide using shadowOpacity (iOS) or elevation (Android). This is not anymore valid in React >= 6.

For this you need to use headerShadowVisible for both iOS and Android.


An example is below:

<Stack.Navigator screenOptions={{
        headerStyle: {
            backgroundColor: Colors.light.tint,
            
        },
        headerShadowVisible: false,
        headerTintColor: Colors.light.background,
        headerTitleAlign: "left",
        headerTitleStyle: {
            fontWeight: 'bold',
        }
    }}>

Sunday, October 17, 2021

tabBarOptions - deprecated in React Native 6 - No overload matches this call.

Fix by using screenOptions as described below:

<MainTab.Navigator
      initialRouteName="TabOne"
      screenOptions={{
        tabBarActiveTintColor: Colors[colorScheme].background,
        tabBarStyle:{
          backgroundColor: Colors[colorScheme].tint,
        }
      }}>

Fix Error: EMFILE: too many open files

Exact error is this:

 Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:203:21)

 

To fix it, please just install watchman on your Linux/OS X system:
 

brew install watchman

Saturday, October 16, 2021

Fix watchman install ERROR: The following formula cannot be installed from bottle and must be built from source

To overcome this issue on Mac OS X, simple install the Command Line Tools using the below command:


  xcode-select --install

Saturday, October 9, 2021

Automatic renew letsencrypt SSL certificate every 3 months

1. Create a simple script to renew and restart Apache httpd server:

[user@scripts]# cat renew-easy-certificates.sh


certbot certonly --webroot -w /var/www/html/easybiny/price -d price.easybiny.com
certbot certonly --webroot -w /var/www/html/easybiny/prod -d easybiny.com
service httpd restart

 

2. Open crontab scheduler

crontab -e 

 

3. Add the following under crontab scheduler:

0 0 1 */3 * sh /path/scripts/renew-easy-certificates.sh

This runs every 3 months on the first day of each month at 00:00. Certificates are now automatically renewed.

Wednesday, October 6, 2021

Fix npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/abbrev'

 Run the following command and it works just fine (tested on OS X) :

sudo npm install --unsafe-perm -g expo-cli

 

For uninstallting expo-cli, following command can be used:

sudo npm uninstall --unsafe-perm -g expo-cli --save

Verify if node.js is installed

 From a terminal, run the following command. It shall tell node.js installed version:


MacBook-Pro ~ % node -v

v14.18.0