React native with react-native-elements - Warnings => 'ListItem.title' prop has been deprecated and will be removed in the next version - react-native-elements

Has anyone gotten rid of these annoying warnings?
'ListItem.title' prop has been deprecated and will be removed in the next version.
* [native code]:null in __expoConsoleLog
- node_modules/react-native/Libraries/LogBox/LogBox.js:36:4 in console.warn
- node_modules/expo/build/environment/muteWarnings.fx.js:18:4 in warn
- node_modules/react-native-elements/src/list/ListItem.js:92:13 in ListItem
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:10989:26 in renderWithHooks
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:14035:27 in mountIndeterminateComponent
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:22002:24 in beginWork$$1
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:20871:23 in performUnitOfWork
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:20848:38 in workLoopSync
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:20456:22 in performSyncWorkOnRoot
* [native code]:null in performSyncWorkOnRoot
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:5703:31 in runWithPriority$argument_1
- node_modules/scheduler/cjs/scheduler.development.js:818:23 in unstable_runWithPriority
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:5698:21 in flushSyncCallbackQueueImpl
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:5686:28 in flushSyncCallbackQueue
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:19845:30 in scheduleUpdateOnFiber
- node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:11880:16 in dispatchAction
* [native code]:null in dispatchAction
* src/hooks/useStores.js:13:2 in useEffect$argument_0
- node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
- node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:135:14 in _callTimer
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:183:16 in _callImmediatesPass
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:446:30 in callImmediates
* [native code]:null in callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:396:6 in __callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:144:6 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:373:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:143:4 in flushedQueue
* [native code]:null in flushedQueue
* [native code]:null in callFunctionReturnFlushedQueue
I'm running this in package.json "react-native-elements": "^2.3.2",
Per their documentation
here
It is a stable version
solution:
Rewrite all UI components, with new tags rather than props

For ListItem deprecation warnings, you can now set many of the props (such as title.) as children.
Upgrade guide that explains it:
https://react-native-elements.github.io/react-native-elements/blog/2020/08/10/2.3-upgrade-guide/
Sample listItem
<ListItem>
<ListItem.Content>
<ListItem.Title style={titleStyle} {...titleProps}>
{title}
</ListItem.Title>
</ListItem.Content>
</ListItem>

Let me expand Dylan's answer for a ListItem, I had the following, that deprecated after upgrading react-native-elements from version 2.3.2 to version 3.4.3:
<ListItem
key={index}
title={"Reset password"}
leftIcon={{
type: "material-community",
name: "lock-reset",
color: "#ccc",
}}
rightIcon={{
type: "material-community",
name: "chevron-right",
color: "#ccc",
}}
containerStyle={styles.menuItem}
onPress={() => resetPassword(navigation)}
/>
As you can see, I had a left icon, a title, and a right icon. So now I have:
<ListItem key={index} onPress={() => resetPassword(navigation)>
<Icon
name={"lock-reset"}
type={"material-community"}
color={"#ccc"}
/>
<ListItem.Content>
<ListItem.Title>{"Reset password"}</ListItem.Title>
</ListItem.Content>
<Icon
name={"chevron-right"}
type={"material-community"}
color={"#ccc"}
/>
</ListItem>
Remember the imports:
import { ListItem, Icon } from "react-native-elements";
Result:

Related

ReactNative navigation 5 - how to obtain `navigation.state.params` (upgrade from 1.x)

Trying to update old react navigation 1.x to current version 5.x.
I need to display different tab icon depend on what value is in navigation.state.params, that were used in 1.x version. This value is set in one of the screen using navigation.dispatch(data).
this is simplified code used with navigation 1.x:
import {TabBarBottom, TabNavigator} from 'react-navigation';
import {MyIcon, AnotherIcon} from './icons.js';
export default TabNavigator({
Home: {screen: HomeRouter},
Profile: {screen: ProfileRouter},
}, {
navigationOptions: ({navigation}) => ({
tabBarIcon: ({focused}) => {
const {routeName, params} = navigation.state;
...
if (params.data === 1) {
return <AnotherIcon />
}
...
return <MyIcon />;
},
}),
tabBarComponent: TabBarBottom,
tabBarPosition: 'bottom',
});
how need to be change to work with React navigation v.5.x? or all I could do is to use React.Context?
You can get the params using the new hook useRoute available in v5.x
Documentation here

TYPO3: CKEditor removes some html tags (e.g. strong, h4)

When I add html content to CKEditor (source-code mode) and then save the html content, some tags are removed - for example <strong> or <h4>.
I am using the default YAML Konfiguration and add my own one:
# EXT:my_ext/Configuration/RTE/Default.yaml
imports:
# Import default RTE config (for example)
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Full.yaml" }
# Import the image plugin configuration
- { resource: "EXT:rte_ckeditor_image/Configuration/RTE/Plugin.yaml" }
editor:
config:
# RTE default config removes image plugin - restore it:
removePlugins: null
removeButtons:
- Anchor
extraAllowedContent: 'a[onclick]'
toolbarGroups:
- { name: basicstyles, groups: [ basicstyles, align, cleanup ] }
- { name: styles }
stylesSet:
- { name: "Rote Schrift", element: "span", attributes: { class: "highlighted red"} }
- { name: "Button", element: "a", attributes: { class: "btn"} }
- { name: "Checkliste", element: "ul", attributes: { class: "check-list"} }
toolbarGroups:
- { name: links, groups: ['MenuLink', 'Unlink', 'Anchor'] }
externalPlugins:
typo3image: { allowedExtensions: "jpg,jpeg,png,gif,svg" }
typo3link: { resource: "EXT:rte_ckeditor/Resources/Public/JavaScript/Plugins/typo3link.js", route: "rteckeditor_wizard_browse_links" }
processing:
HTMLparser_db:
denyTags: null
Furthermore I have the following TS page config (not sure if this is used by TYPO3 - it's a setup of the old RTE editor):
RTE.default.enableWordClean.HTMLparser {
allowTags = a,b,blockquote,br,div,em,h2,h3,h4,h5,h6,hr,i,img,li,ol,p,span,strike,strong, ...
I finally found the solution, by comparing my Custom.yaml with typo3\sysext\rte_ckeditor\Configuration\RTE\Full.yaml
To allow more tags I had to add the new tags in the following sections of my Yaml file:
editor:
config:
allowTags:
- link
- strong
- h4
processing:
allowTags:
- link
- strong
- h4

react-native-fbsdk / Facebook iOS SDK - undefined is not an object (evaluating 'LoginManager.logInWithReadPermissions')

I am getting an error when trying to use react-native-fbsdk. I assume its some issue with the SDK installation process but I am not sure.
Installation appears to go without error but when trying to use the SDK I am getting this error:
undefined is not an object (evaluating
'LoginManager.logInWithReadPermissions')
Code that is using the SDK:
try {
var result = await LoginManager.logInWithReadPermissions(["public_profile"]);
if (result && result.isCancelled) {
console.log("Login cancelled");
} else {
console.log(
"Login success with permissions: " +
result.grantedPermissions.toString()
);
}
} catch (e) {
console.error(e.message);
}
Installation instructions:
npm install react-native-fbsdk
react-native link react-native-fbsdk
cd ios
pod init
// Add "pod 'FacebookSDK'" to pod file
pod install
// Configure Info.plist and AppDelegate.m
The first 2 commands are specified here: https://github.com/facebook/react-native-fbsdk
The rest of the process is specified here: https://developers.facebook.com/docs/ios/getting-started/#settings
Does anyone have any idea what might be going wrong?
Thanks
Environment:
- macOs High Sierra
- XCode (10.1)
- FacebookSDK (4.38.0)
- react (16.6.1)
- react-native (0.57.5)
- react-native-fbsdk (0.8.0)
There is another unresolved question from someone who appears to have the same problem but he did not specify his installation process or package versions.
Facebook SDK react LoginManager.logInWithReadPermissions undefined is not an object
You have to run react-native link react-native-fbsdk, and check in your native project (ios or android) if it is linked successfully, if not, then do it manually.
1. go to Library file under your project, and right click to choose 'Add files to "Your project". and choose react-native-fbsdk =>ios => RCTFBSDK.xcodepro.
2. add libRCTFBSDK.a to your 'Linked Franmework and Libraray'.
It should work, otherwise check your version of the SDK, since the least version has changed something.
Here is my install procedure. it's work.
1. Install react-native-fbsdk
react-native install react-native-fbsdk
2. Install SDK
Add following lines to ios/PodFile and execute pod install
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
If no FBSDKShareKit will build failed with: fatal error: 'FBSDKShareKit/FBSDKShareKit.h' file not found
3. Set Info.plist
Add following lines to ios/Project Name/Info.plist (According to https://developers.facebook.com/docs/ios/getting-started/)
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb369704160457623</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>Your facebook app id</string>
<key>FacebookDisplayName</key>
<string>Your app name</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
Replace FacebookAppID, FacebookDisplayName key values to you actually use.
4. Modify AppDelegate.m
According to https://developers.facebook.com/docs/ios/getting-started/.
// AppDelegate.m
#import <FBSDKCoreKit/FBSDKCoreKit.h> // Add this line
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions]; // Add this line
// Add any custom logic here.
return YES;
}
// Add following lines
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
// Add any custom logic here.
return handled;
}
5. Modify App.js
Import LoginManager at header.
Add login() function to call LoginManger.logInWithReadPermissions().
Add component to at render().
App.js as following
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* #format
* #flow
*/
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import { LoginManager } from "react-native-fbsdk";
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
export default class App extends Component<Props> {
login() {
LoginManager.logInWithReadPermissions(["public_profile"]).then(
function (result) {
if (result.isCancelled) {
console.log("Login cancelled");
} else {
console.log(
"Login success with permissions: " +
result.grantedPermissions.toString()
);
}
},
function (error) {
console.log("Login fail with error: " + error);
}
);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
<TouchableOpacity onPress={this.login.bind(this)}>
<Text>FBLogin</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
6. Run
react-native run-ios
7. My environment:
React Native Environment Info:
Binaries:
Node: 11.2.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.3, 24.0.1, 25.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.2, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.1 => 16.6.1
react-native: 0.57.7 => 0.57.7
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native-rename: 2.3.2

TYPO3 CKeditor not rendering javascript link

I am using TYPO3 8.7.8 and have to provide a javascript link to deactivate Google Analytics.
The link should look like this:
Deactivate Google Analytics
Unfortunately the link doesn't appear in the frontend, that means it's just a normal text inside a <p> tag. However in the backend everything is fine and it shows up as a link there...
Here is my yaml-configuration for the CKeditor:
# Load default processing options
imports:
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml" }
# Configuration for the editor
# For complete documentation see http://docs.ckeditor.com/#!/api/CKEDITOR.config
editor:
config:
allowedContent: true
linkJavaScriptLinksAllowed: true
contentsCss: ["EXT:rte_ckeditor/Resources/Public/Css/contents.css", "EXT:my_extension/Resources/Public/Stylesheets/styles.css", "EXT:my_extension/Resources/Public/Stylesheets/fonts.css"]
resize_enabled: true
stylesSet:
# block level styles
- { name: "Button Default", element: "a", attributes: { 'class': 'btn btn-default', 'role': 'button', 'aria-pressed': 'true'}}
format_tags: "p;h1;h2;h3;h4;h5;pre"
toolbarGroups:
- { name: styles, groups: [ styles, format ] }
- { name: basicstyles, groups: [ basicstyles ] }
- { name: paragraph, groups: [ list, indent, blocks, align ] }
- { name: links, groups: [ links ] }
- { name: clipboard, groups: [ clipboard, cleanup, undo ] }
- { name: editing, groups: [ spellchecker ] }
- { name: insert, groups: [ insert ] }
- { name: tools, groups: [ table, specialchar ] }
- { name: document, groups: [ mode ] }
justifyClasses:
- text-left
- text-center
- text-right
- text-justify
extraPlugins:
- justify
removePlugins:
- image
removeButtons:
- Anchor
- Underline
- Strike
buttons.:
link.:
queryParametersSelector.:
enabled: true
What am I missing here?
we just run into the same problem - we wrote a small linkhandler for typo3 allowing only the javascript:gaOptOut(); link.
Get it here:
https://www.infoworxx.de/download/ifx_linkhandler_googleAnalytics.zip
Sebastian
That is not a problem of ckeditor but is prohibited by TYPO3 itself to avoid security issues - XSS.
A solution I use is something like this TYPO3 force internal links to cross domain pages to use https in news so that an editor e.g. links to http://ga-output.tld and this will be replaced by the JS link.
You can add a class to your link in ckeditor using the source button (<>).
<a class="gaOptout" href="#">your linked text</a>
and now you just rewrite your function to an onclick event like this:
$('.gaOptout').on('click', function(){
your function
});
This still seems to be an issue in T3 9.5, especially with this Google OptOut Script.
Easy workaround without coding: we cut out the paragraph containing the javascript and put it in a separated html-element. Just cut it out from CKEs Source-view an paste it in a new element. To keep the article in sequence, just cut out the rest of the text an paste it in a new text-element.

react native: How to set Image defaultSource on Android

react native: How to set Image defaultSource on Android.
I have read the React native 1.58 document. I found the Image props defaultSource supported iOS only.
I need to set the default Image when the network Image load error.
I used to write the code like this:
{ ImageUrl?
<Image style={styles.docimg}
source={{uri: ImageUrl}}/>
:
<Image style={styles.docimg}
source={require('../../../resource/default.png')}/>
}
Now there is a problem. When the URL is a string type, but it isn't a correct network Image. As the URL is true then the Image will show nothing.
I saw the Image props onError maybe solve my issue.
I need to set the placeholder Image.
I have tried using #Ravi Raj's answer but seems not related to failure on loading image.
Beside the answer will make the image keep flashing between the default and actual image. ( The error that #vzhen met )
Therefore I have developed based on his answer and generated this component. See if this suits you ;)
progressive-image.js - Component <ProgressiveImage/>
import React, { Component } from 'react';
import { Image } from 'react-native';
export default class ProgressiveImage extends Component {
state = { showDefault: true, error: false };
render() {
var image = this.state.showDefault ? require('loading.png') : ( this.state.error ? require('error.png') : { uri: this.props.uri } );
return (
<Image style={this.props.style}
source={image}
onLoadEnd={() => this.setState({showDefault: false})}
onError={() => this.setState({error: true})}
resizeMode={this.props.resizeMode}/>
);
}
}
Then import and call the component like this:
import ProgressiveImage from './progressive-image';
<ProgressiveImage style={{width: 100, height: 100}}
uri={'http://abc.def/ghi.jpg'}
resizeMode='contain'/>
Hope this answer can help you ;)
You just try this and hope it works...
// initially showDefault will be false
var icon = this.state.showDefault ? require('../../../resource/default.png') : {uri: ImageUrl};
return(
<Image
style={styles.docimg}
source={icon}
onLoadStart={() => this.setState({showDefault: true})}
onLoad={() => this.setState({showDefault: false})}
/>
)
Setting showDefault = false in onLoad() should not trigger url
fetch again since images are cached by default in android and IOS.
Work for me
<ImageBackground
style={{
width: 100,
height: 100,
marginRight: 20,
borderRadius: 10,
}}
source={
require('../../assets/images/Spinner.gif') //Indicator
}>
<Image
style={{
width: 100,
height: 100,
marginRight: 20,
borderRadius: 10,
}}
source={{
uri: `//Image U want To Show`
}}
/>
</ImageBackground>
const [error, setError]=setState(false);
return(){
<Image
onError={(error) => {
setError(true);
}}
source={
error
? require("../../assets/images/defaultImage.png")
: { uri: imageUrl }
}
/>
}
This will show the default image if your network image fails to load or gives an error 404.
According to the docs, the defaultSource prop is ignored on Android on Debug builds, so if you are looking for a placeholder while the actual source is loading -- not in case of errors -- make sure to test on release mode before implementing workarounds to load it only because of debug mode.
"Note: On Android, the default source prop is ignored on debug builds."
defaultSource doesn't work on android...
Please follow the method bellow to fix it:
Dont forget to import View, ImageBackground, & Image
class MyComponent extends Component {
constructor() {
this.state = {
isImageLoading: true,
}
}
render() {
<View>
<ImageBackground
source={{ uri: this.state.isImageLoading ? YOUR_DEFAULT_IMAGE : null }}
>
<Image
source={{ uri: YOUR_IMAGE }}
onLoad={() => this.setState({ isImageLoading: false })}
/>
</ImageBackground>
</View>
}
}

Resources