Wednesday, August 5, 2020

[React Native] - Default Layout Values

If you are working with React Native, you can check this summary table with defaults values of style properties.

Layout property    |    default value    |    doc link
-----------------------------------------------------------------
alignItems                          stretch                          https://reactnative.dev/docs/layout-props#alignitems

directions                           inherit                          https://reactnative.dev/docs/layout-props#direction

flexDirection                      column                         https://reactnative.dev/docs/layout-props#flexdirection

fledWrap                            nowrap                         https://reactnative.dev/docs/layout-props#flexwrap

justifyContent                    flex-start                       https://reactnative.dev/docs/layout-props#justifycontent

overflow                             visible                           https://reactnative.dev/docs/layout-props#overflow

position                               relative                         https://reactnative.dev/docs/layout-props#position

If you are using some of this props on your stylesheet, you can remove them, unless they are being used to rewrite other previous conditions.

Tuesday, March 10, 2020

[xCode] - runtime is not available


Error message while try to run your application on simulator


If you got this error "The iOS XX.X simulator runtime is not available" (where XX.X is the version of iOS on simulator) while trying to run your application on simulator only need to kill all open CoreSimulatorService.
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService

Thursday, February 27, 2020

[React Native] - Fast refresh stop working!

If you are developer and working with React Native, you know all the advantages of fast refresh when you write your app. This feature are available from version 0.61 of react native (original post)

But if this feature stop working when you need them?

It happened to me and just changed the versions of external modules!

Start searching for solutions! https://github.com/facebook/react-native/issues?q=is%3Aissue+Fast+refresh+stop+is%3Aclosed

But the problem persist!

Resolution attempts (without success)

1. Revert all changes on external modules!


2. Clear all caches and external dependencies (npm, watchman and node_modules)


rm -rf ~/.npm
watchman watch-del-all
rm -rf node_modules

npm i
Panic mode ... Still not working!!!

My last hope, checkout the project to new folder try to see if it works... and i'm happiness, fast refresh working again.

So, just need compare the differences between this two same projects folders and find the changed files!

Differences founded...

File: git/.git/index.lock
I think this differences still related with my changes on external modules, but let me try to delete the lock file and run my project again.

Oh yes! The fast refresh working again.

Conclusion, if you have the same problem, only need delete git/.git/index.lock (on your base project folder) to get back fast refresh working.

rm -rf git/.git/index.lock

Wednesday, February 19, 2020

[TERMINAL] - How to zip files as individual zip files


If you want to zip all files inside folder as individual zip files without extension, only need to open terminal and paste command:
for i in *; do zip "${i%%.*}" "$i"; done

Change *; to *.your_extension_file; to ignore all other file types.

ex:

open terminal and navigate to the folder (where exist the files to compress)

1. cd /Download

2. compress only text files

for i in *.txt; do zip "${i%%.*}" "$i"; done