Make image adapt to background colour in React Native - reactjs

I am working on an app that includes the user taking a picture, then editing it. However, I have noticed that when the buttons used for editing are displayed, they are often not very visible due to the image background. The buttons contain images that have their colour set by tintColor. I would like the buttons to be visible no matter what the colours of the image are. I have found a CSS filter that achieves this, but there is no React Native implementation of it. I have also found a library that can do this (react-native-color-matrix-image-filters), but I cannot use it because I am using a managed Expo project with Expo Go.
Any help would be much appreciated. :)

Starting from Expo SDK 42, you can install a native library with Expo, you just need to compile a custom Expo Go client app with a native module (react-native-color-matrix-image-filters) pre-compiled and embedded.
You still have amazing Expo DX use native module support.
Check how to compile Expo Go Custom App here - https://www.youtube.com/watch?v=id0Im72UN6w&t=25s

Related

How to embed a website in expo React Native

I want to embed or just redirect to a website I made which uses a webcam. I can redirect to the website with webView however the camera doesn't work.
This is the website I want to embed. https://chinmaymhatre.github.io/currency_detector
I don't think you can permit camera access inside a webview in a react native or expo app because of security concerns, neither could I find anything like that.
I think it would be easier to just implement this right into the react native app(if the app you want to show in the webview is written in javascript)
I have tried something similar. So, sometime ago I was making a video streaming app using React Native for a website that I made using WebRTC which was using camera and other medias(Video, Audio and Screen). I tried to be smart and tried to embed the webpage directly into the React Native App. My Idea was that I could access the Camera and other user media in Mobile Browser So, it should work with React Native as well. But this is not how the react-native works, React Native doesn't uses iframe to work or in other words react-native develops Native Apps for both IOS and Android. You can always implement an iframe in expo, but this is against the Device Security to provide such level of access to user-media. The device doesn't allow such functionality via iframe (here's the link to a live example how to implement iframe in expo). So, to understand it better You should use react-native-cli to make a simple app not expo. Now for using camera in expo there's a package called expo-camera (here's link) Which helps you develop camera oriented apps using Expo. If this doesn't answer your questions then let me know. Happy Coding :)

Is there any implementation of change language available on button click in react native expo localization..?

I am trying to implement multilanguage support of arabic language in react native expo app. I found many packages on internet but I am using localization module in my expo app. For that I found a solved example on expo snack.
https://snack.expo.io/#marcelkalveram/localizaton-example
but its giving an error. can anybody solve the error.
I want to change the language of whole expo app in arabic on button click, but I haven't found such implementation in expo app.
If any one has encountered similar problem in expo app or if anyone knows another good solution which fulfills my requirement of changing app language on button click, please help..
Thanks..
Use i18n-js with expo localization, read the expo documentation for the usage. https://docs.expo.io/versions/latest/sdk/localization/

How to create a ReactJS zoomable image lightbox

I'm creating a gallery of images in ReactJs. There are a lot of examples online, but i didn't find anything that is perfectly responsive on desktop browsers and also completely mobile friendly.
In particular, when an image is opened on the mobile browser, i need to be able to zoom the photo with a double tap, and close the photo when i drag it to the bottom
I already tried all the principal solution that i found online.
For example, i tried all of these https://reactjsexample.com/tag/lightbox/
and much much more.
I also tried different approaches like CSS rules, Viewport rules, create a simple zoomable html div, etc... But nothing worked.
Basically, what i what to achieve is exactly something like this: https://www.lucapetruzzi.com/gallery/1
Created thanks to this library: https://photoswipe.com/ that unfortunately i can't use in React.
(I also tried the react-photoswipe and react-photoswipe-2 libraries but it seems not maintained and not working with new versions of React)
Thank you for any help
So for previous comments, I wrote a snippet for you, check here
Here are the mainly steps:
use npm install photoswipe so DON'T need to include builded js but NEED to include css in index.html (or you can import in App.css)
write the markup in js component
init it by click button or in useEffect

Creating an OSM map app with React native and Expo

i need a hint... started in React native and tried Expo. Goal is to create an OSM map app for hiking. So far i run into 2 problems:
no background works in Expo location
no OSM map plugin compatible with Expo
First might be resolved in the future, the Expo guys work on that.
Second... using something like the mapbox for JS will not help, as i did not see any solution for offline caching.
Now i am asking myself if i should continue without Expo using pure React native (mapbox SDK will offer caching), or keep Expo and create a map-box on my own (loading tiles based on lat/lon and displaying the current position on a tile is not that hard...)
Any experiences for a similar problem?
As this is kind of a learning project i am not interested in available apps, i am already using some of them ;)
Thanks and regards, Jo

What is the most up-to-date approach to add my own Splash Screen in Sencha Touch

I need my own splash screen when starting up my app.
I use SenCha Touch + Cordova.
Searched and found several ways to do splash screens, however I do not think they are up-to-date.
I saw some code which tried to add a few lines of code into launch function, but the latest Sencha Touch does not do it in the app.js any more instead, it add the Main view to its viewport.
Also, I checked Sencha Touch doc and found
Class currently only works with Cordova and does not have a simulated
HTML counter part. Please see notes on Cordova Docs for proper Native
project code changes that will need to be made to use this plugin.
But it provides some methods after that statement :
newExt.device.Splashscreen( ) : Ext.device.Splashscreen
So I feel confused and don't know which one should I follow.
What is the latest approach to do the splash screen in Sencha Touch?
I currently have the exact same problem as you. Here is information I got from Sencha:
All splashscreen functionality is provided by the Cordova/Phonegap plugin. Our class methods are just convenience methods to the cordova native API and will provide a 'stub' for you if Cordova is not available so that your application does not bomb upon startup (no splashscreen shows, it's just that your app will not crash when trying to access an API that is not there).
In theory, if your application is built with Cordova/Phonegap and your splashscreen images are provided with the application build as specified by Cordova/Phonegap you would initiate a call to Ext.device.Splashscreen.show() after the device is ready (as demonstrated in the example found in http://docs.phonegap.com/en/2.6.0/cordova_splashscreen_splashscreen.md.html#Splashscreen)
The splashscreen feature is a native API, not one that is provided by Touch. You can, should you wish, provide your own coding in your index.html file of your native application which will manually display an image (much the same way we do the initial CSS flashing load indicator), but ultimately that would be up to you to implement manually.
I would suggest that you follow the Cordova guidelines, place your images in the res/drawable directory of your android project and let Cordova do all the hard work for you by just making a single call to Ext.device.Splashscreen.show() when the device is ready and then calling Ext.device.Splashscreen.hide() in the launch area of your application to hide it when your app has rendered its view.
To include Cordova in your application, we now provide you with sencha cmd switches to enable Cordova. You can find more information here
http://docs.sencha.com/touch/2.3.1/#!/guide/cordova
Please note that you will have to download all required components of Cordova, modify the Cordova configuration files as outlined in the Cordova docs, and build the application using either the Cordova command line interface (CLI) or your favourite Android build IDE (Eclipse, IntelliJ, etc).
Use this plugin https://build.phonegap.com/plugins/620
When you use this plugin and build locallym you have to place the icons and splashscreen in the res/ folder manually.

Resources