Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
react-native-speech-to-text
Advanced tools
React Native module that allows you to call native speech recognition API and to get the text recognized in return. This is a work in progress since it only works on Android for now. The work on iOS is nearly finished.
React Native module that allows you to call native speech recognition API and to get the text recognized in return. This is a work in progress since it only works on Android for now. The work on iOS is nearly finished.
Run npm i react-native-splash-screen --save
react-native link react-native-splash-screen
or rnpm link react-native-splash-screen
Android:
1.In your android/settings.gradle file, make the following additions:
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
2.In your android/app/build.gradle file, add the :react-native-splash-screen
project as a compile-time dependency:
...
dependencies {
...
compile project(':react-native-splash-screen')
}
3.Update the MainApplication.java file to use react-native-splash-screen
via the following changes:
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SplashScreenReactPackage() //here
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
iOS:
In XCode, in the project navigator, right click Libraries
➜ Add Files to [your project's name]
Go to node_modules
➜ react-native-splash-screen
and add SplashScreen.xcodeproj
In XCode, in the project navigator, select your project. Add libSplashScreen.a
to your project's Build Phases
➜ Link Binary With Libraries
To fix 'SplashScreen.h' file not found
, you have to select your project → Build Settings → Search Paths → Header Search Paths to add:
$(SRCROOT)/../node_modules/react-native-splash-screen/ios
Android:
Update the MainActivity.java file to use react-native-splash-screen
via the following changes:
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import com.cboy.rn.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this); // here
super.onCreate(savedInstanceState);
}
// ...other code
}
iOS:
You should add following code to AppDelegate.m for keeping launch image:
#import "AppDelegate.h"
#import "RCTRootView.h"
#import "SplashScreen.h" // here
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...other code
[SplashScreen show]; // here
return YES;
}
@end
Import react-native-splash-screen
in your JS file.
import SplashScreen from 'react-native-splash-screen'
Add a file called launch_screen.xml in the layout as the splash screen.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/launch_screen">
</LinearLayout>
Optional steps:
You can also via the following steps to set the window transparent.
open android/app/src/main/res/values/styles.xml
, to add <item name="android:windowIsTranslucent">true</item>
,like this :
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<!--设置透明背景-->
+ <item name="android:windowIsTranslucent">true</item>
</style>
</resources>
Learn more to see Examples
iOS can be used to customize your startup screen via LaunchImage or LaunchScreen.xib.
Learn more to see Examples
Then you can use it like this:
import SplashScreen from 'react-native-splash-screen'
export default class WelcomePage extends Component {
componentDidMount() {
// do anything while splash screen keeps, use await to wait for an async task.
SplashScreen.hide();
}
}
Method | Type | Optional | Description |
---|---|---|---|
show() | function | false | Open splash screen |
hide() | function | false | Close splash screen |
Issues are welcome. Please add a screenshot of bug and code snippet. Quickest way to solve issue is to reproduce it on one of the examples.
Pull requests are welcome. If you want to change API or making something big better to create issue and discuss it first.
MIT Licensed
FAQs
React Native module that allows an React Native application to call native speech recognition APIs and to get the recognized text in return. This is a work in progress since it only works on Android. Although the work on iOS is almost finished.
We found that react-native-speech-to-text demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.