Is Intl.Collator possible in an Expo Managed react native app? - expo

Do Expo managed react native apps have access to an Intl Collator?
I don't see it in the docs but thought I'd ask.
Looking to use it for sorting like this ๐Ÿ‘‡.
import { createNewSortInstance } from 'fast-sort';
const naturalSort = createNewSortInstance({
comparer: new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }).compare,
});

It will be in the next SDK that includes React Native 65.0. See https://reactnative.dev/blog/2021/08/17/version-065#whats-new-in-hermes-08 and https://expo.fyi/react-native-releases

Related

using Gatsby, the build fails,

I get a new bug, when trying to do yarn build
2 | //# sourceMappingURL=react-table.production.min.js.map
3 |
WebpackError: ReferenceError: regeneratorRuntime is not defined
image is attached
this is coming from a component that uses react-table, this is a new bug that "suddenly" happened.
any tips?
As you can follow in this Gatsby discussion what ends in this thread from react-table the issue rises because of the useAsyncDebounce you're using, which internally uses async/await.
You have two solutions:
Importing regenerator-runtime/runtime at the top of your component:
import 'regenerator-runtime/runtime';
import React from 'react';
import {
useAsyncDebounce,
useFilters,
useGlobalFilter,
useTable,
} from "react-table"
Configuring your browserlist to include the polyfill automatically. In your package.json:
{
"browserslist": [">0.25%", "not dead", "since 2017-06"]
}
You have to add a version thatโ€™s recent enough to support async/await, so Babel does not try to add a polyfill. Check them at https://github.com/browserslist/browserslist

TypeError: Cannot read property 'AwsCredentialsProvider' of undefined

Been trying to test out the aws-iot-device-sdk-v2 library for a bit. I am currently trying to test out the sample app provided by the AWS dev team. I am trying to test out the system incrementally. This is the code I have tested so far:
import { mqtt, auth, http, io, iot } from 'aws-iot-device-sdk-v2';
const client_bootstrap = new io.ClientBootstrap();
let config_builder = iot.AwsIotMqttConnectionConfigBuilder.new_with_websockets({
region: 'us-west-2',
credentials_provider: auth.AwsCredentialsProvider.newDefault(client_bootstrap)
});
config_builder.with_clean_session(false);
config_builder.with_endpoint('example.com');
config_builder.with_client_id(1);
const config = config_builder.build();
const client = new mqtt.MqttClient(client_bootstrap);
const connection = client.new_connection(config);
await connection.connect();
When running this on the AWS console, I am getting the following error:
TypeError: Cannot read property 'AwsCredentialsProvider' of undefined
Any idea what I'm doing wrong here?
Wasn't able to identify why I couldn't use AwsCredentialsProvider as expected but found a work-around. Instead, I was able to initialize the builder with const config_builder = iot.AwsIotMqttConnectionConfigBuilder.new_with_websockets();. Anyway, didn't figure out why I couldn't utilize AwsCredentialsProvider as expected. Might be something to look into if the dev team has time. ๐Ÿ‘
I also encounter the same issue when running this example in browser and found the reason :
'aws-iot-device-sdk-v2' just import these 5 classes directly form aws-crt
https://github.com/aws/aws-iot-device-sdk-js-v2/blob/main/lib/index.ts
while in aws-crt, it's implementation for browser is in a sub folder ,
https://github.com/awslabs/aws-crt-nodejs/tree/main/lib/browserm, and it don't include 'auth' .
so if you run these example in browser, you need to import form aws-crt's subfolder, and skip 'auth':
import { mqtt, http, io, iot } from 'aws-crt/dist.browser/browser';

Enabling Change Tracking for Entity

Is there a way to enable change tracking for couple of entities programmatically? I could not find any api in Dataverse which can help to do this.
You cannot do that with webapi but you can definitely achieve this programatically.
you can either create console application or you can run code now plugin for xrmtoolbox and get this done.
Below code snippet for reference.
UpdateEntityRequest updateBankAccountRequest = new UpdateEntityRequest
{
Entity = BankAccountEntity,
ChangeTrackingEnabled = true //or false here
};
_serviceProxy.Execute(updateBankAccountRequest);
Microsoft docs for ChangeTrackingEnabled

Expo Image Picker vs RN-image picker

I am quite new to RN . I know this question is being repeated but I didn't quite get ans I was looking for there .
So my current project uses
expo for web and react-native cli for the android set up .
I want to add an image-picker to the project.
I see two options at my side .
RN-image-picker
expo-image-picker
I have some issues and some questions !!
Is RN-native-image picker comaptible with web ??
I think its not ,there are two resons I think that ,this lib uses Nativemodules, which
won't be bundled for web and its giving undefined error for NativeModules when I run with
web while it works fine on android .
Should I use expo-image-picker when I am creating a android build with react-native cli ??
The build doesn't give errors and it shouldn't ,but when I click on upload image ,app
crashes after I select image.I read the docs and github for the issue.Many people pointed
out its ram allocation issue,which can be sorted with disbaling "Dont keep activities" in
developer's option,which I haven't tried yet .
Also on web ,the following code snippet returns base64 as uri,is it default behaviour ??
I am using this code snippet for expo-image-picker,which ends up crashing app when I build app with rn cli,but doesn't seem to cause issues with expocli build.But I want to use expo for web and rn for android.
Also on web ,the following code snippet returns base64 as uri,is it default behaviour ??
const pickImage = async () => {
try{
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [4, 3],
quality: 1,
base64:false
})
if(!result.isCancelled)return result.uri ;
}catch(err){
console.log(err) ;
}
}
So what should I do in this case,use expo-image-picker as it seems to be compatible with all platforms/both ?
Any kind of input would be helpful !!
I'm not a fan of Expo, and I don't have experience with that but I try to answer to your question that can be.
Is RN-native-image picker comaptible with web ??
You have right, the library supports only mobile devices.
Should I use expo-image-picker when I am creating an android build with react-native cli ??
From expo documentation, I read that but I know also that sometimes the rn-cli and expo has some package differences, and this answer proves that.
Expo never locks you in, you can "eject" at any time and your project will just be a typical native project with the React Native and Expo SDK packages that your app is using installed and configured.
I don't know what the exception, and maybe the solution that you put in your answer work well, but maybe is possible to have some dependency mismecc? Such as a none object on the Web app? or something like that.
Also on web ,the following code snippet returns base64 as uri,is it default behaviour ??
This looks like be an bug and this issue on github maybe can confirm my idea

Ember - Change current route from browser console

I am not at all Ember developer, but I would like to change current route from browser console. Is it possible at all to access correctly Ember, e.g. Ember.Router.prototype.transitionTo('/feed')?
Version of the website is 3.16.9
After a lot of research, I have found out possible solutions that you can use. I was trying to achieve it on Linkedin website via Chrome Extension
function runEmbedded(path) {
const namespaces = window.Ember.Namespace.NAMESPACES;
let application;
namespaces.forEach(function (namespace) {
if (namespace instanceof window.Ember.Application) {
application = namespace;
return false;
}
});
application.__container__.lookup('router:main').transitionTo(path);
}
const payload = '/some/new-path'
script.text = `(${runEmbedded.toString()})('${payload}');`;
document.documentElement.appendChild(script);
Second solution/hack:
Another possible hack to use, when the website is not listening to pushState/replaceState actions from History API is to push state 2 times and then go back. Please remember that's only a hack.
history.pushState({}, '', msg.payload);
history.pushState({}, '', msg.payload);
history.back();